
from distutils.core import setup
import py2exe
import os, shutil, time, sys, subprocess

sys.argv.append('py2exe')

setup(
	windows=[{"script":"citecheckGui.pyw"}], 
	options={"py2exe":{"includes":["sip", "PyQt4._qt"]}}
	)

basename = "citecheck"

if os.path.exists(basename):
	shutil.rmtree(basename)
os.rename("dist",basename)

if os.path.exists(basename+"-"+time.strftime("%Y-%m-%d.%Hh%M")+".exe"):
	os.remove(basename="-"+time.strftime("%Y-%m-%d.%Hh%M")+".exe")

zipPath = '"C:\\Program Files\\7-Zip\\7z.exe"'
subprocess.Popen(" ".join([zipPath, "a", "-t7z", "-r", "-sfx7z.sfx", basename+"-"+time.strftime("%Y-%m-%d.%Hh%M")+".exe", basename+"/"]))

